import { initI18n, getModuleByMetaGlob, resetI18n, getModules } from "../i18n-use";

//const files = import.meta.globEager('./modules/**/*.json')
const files = import.meta.glob('./modules/**/*.json', { eager: true })
//files.keys().forEach((key) => {
//  const fileContent = files(key);
//  console.log(fileContent)
//  // do something with the file content
//});
//const locales = getLocales(modules);
//console.log(locales)
//resetI18n();
initI18n({
  locales: getModuleByMetaGlob(import.meta.glob('./modules/**/*.json', { eager: true })),
  defaultLocale: 'in',
  useLocales: ['en', 'zh', "in"]
})
//console.log(getModuleByMetaGlob(files))
//console.log(getModules(files, 'glob'))
//console.log(require.context())
//initI18n({
//  path: './modules/**/*.json'
//})

//const locales: any = (import.meta as any).glob('./modules/**/*.json', { eager: true })
////console.log(locales)
//console.log(import.meta.hot)

//const locales1: any = (import.meta as any).globEager('./modules/**/*.json', { eager: true })
//console.log(locales1)

//const glob = (path: string) => {
//  if (!path || !import.meta) return {};

//  try {
//    return import.meta.globEager(path);
//  } catch (e) {
//    console.log(e)
//  }
//  try {
//    const paths = `'./modules/**/*.json`
//    console.log(paths)
//    return import.meta.glob(paths, { eager: true })
//  } catch (e) {
//    console.log(e)
//  }
//}